package com.zpf.service.Impl;

import com.zpf.dao.BookDao;
import com.zpf.dao.Impl.BookDaoImpl;
import com.zpf.domain.Book;
import com.zpf.domain.Page;
import com.zpf.service.BookService;

import java.util.List;

public class BookServiceImpl implements BookService {
    private BookDao bookDao = new BookDaoImpl();

    @Override
    public List<Book> findAll() {
        return bookDao.selectAll();
    }

    @Override//删除
    public void removeBook(int bookId) {
        bookDao.delete(bookId);
    }

    @Override//更新
    public Book findById(int bookId) {
        return bookDao.selectById(bookId);
    }

    @Override
    public void modify(Book book) {
        bookDao.update(book);
    }

    @Override//新增
    public void addBook(Book book) {
        bookDao.insert(book);
    }

    @Override
    public List<Book> findAllPage(Page page) {
        List<Book> list = bookDao.selectAllByPage(page);
        return list;
    }

    @Override
    public int findAllPageCount() {
        int count = bookDao.selectAllByPageCount();
        return count;
    }
}
